import request from '@/plugins/request'
import { IResponseData } from '@/types/request-base'
import { json2FormData } from '@/utils'

// 经销商档案新建

/**
 * 经销商档案新建进度
 * @param {string} ID
 */
export function getProgress(id: string) {
  return request<IResponseData>({
    method: 'get',
    url: `/app/v1/ctmCustomerChange/progress/infoCreate/${id}`
    // loading: true,
    // errorShow: true
  })
}

/**
 * 经销商档案新建-创建档案
 * @param {string} ID
 */
export function createSaveBasic(data: any) {
  return request<IResponseData>({
    method: data.id ? 'put' : 'post',
    url: `/app/v1/ctmCustomerChange`,
    data: { ...data, ...{ type: 'A' } },
    loading: true
  })
}

/**
 * 经销商档案新建-提交
 * @param {Array} data
 */
export function submitChange(data: any) {
  return request<IResponseData>({
    method: 'PUT',
    url: `/app/v1/ctmCustomerChange/infoCreate/submit`,
    data,
    loading: true
  })
}

/**
 * 经销商新建档案详情
 * @param {string} ID
 */
export function detail(id: string) {
  return request<IResponseData>({
    method: 'get',
    url: `/app/v1/ctmCustomerChange/detail/infoCreate/${id}`,
    loading: true
    // errorShow: true
  })
}
